<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>房联行增值服务部后台管理中心</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="stylesheet" href="./css/font.css">
		<link rel="stylesheet" href="./css/xadmin.css">
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="./js/xadmin.js"></script>
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	</head>

	<body>
		<div class="x-body">
			<form class="layui-form" action="">
				<div class="layui-form-item center">
					<label class="layui-form-label">案例主图</label>
					<div class="layui-inline" style="margin:0px">
						<img class="layui-upload-img" id="img_show" height="132" style="max-width: 190px;" src="">
						<p id="demoText"></p>
					</div>
					<div class="layui-inline">
						<div class="layui-field-box" style="padding:0px;">
							<div class="layui-upload-drag" id="img">
								<i class="layui-icon layui-icon-add-circle-fine"></i>
								<p>点击添加设计师头像</p>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">设计师姓名</label>
						<div class="layui-input-inline">
							<input type="text" name="title" required="" lay-verify="required"autocomplete="off" placeholder="请输入案例标题" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">手机号</label>
						<div class="layui-input-inline">
							 <input type="tel" name="phone" lay-verify="required|phone" autocomplete="off" class="layui-input">
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">所在区域</label>
						<div class="layui-input-inline">
							<input type="text" name="address" required="" lay-verify="required" autocomplete="off" placeholder="请输入所在区域" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">职务</label>
						<div class="layui-input-inline">
							<input type="text" name="job" required="" lay-verify="required" autocomplete="off" placeholder="请输入职务" class="layui-input">
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					
					<div class="layui-inline">
						<label class="layui-form-label">擅长风格</label>
						<div class="layui-input-inline">
							<select name="style" required="" lay-verify="required">
								<option value="">请选择</option>
								<option value="混搭">混搭</option>
								<option value="欧式">欧式/简欧</option>
								<option value="中式">中式</option>
								<option value="新古典">新古典</option>
								<option value="东南亚">东南亚</option>
								<option value="美式">美式</option>
								<option value="北欧">北欧</option>
								<option value="地中海">地中海</option>
								<option value="现代">现代/简约</option>
								<option value="日式">日式</option>
							</select>
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">擅长户型</label>
						<div class="layui-input-inline">
							<select name="room" required="" lay-verify="required">
								<option value="">请选择</option>
								<option value="混小公寓搭">混小公寓搭</option>
								<option value="平层">平层</option>
								<option value="复式">复式</option>
								<option value="大宅">大宅</option>
								<option value="别墅">别墅</option>
							</select>
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">收费标准</label>
						<div class="layui-input-inline">
							<input type="text" name="price" required="" lay-verify="required" autocomplete="off" placeholder="元/平米" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">毕业院校</label>
						<div class="layui-input-inline">
							<input type="text" name="eduction" required="" lay-verify="required" autocomplete="off" placeholder="请输入毕业院校" class="layui-input">
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">工作年限</label>
						<div class="layui-input-inline">
							<input type="number" name="years" required="" lay-verify="required" autocomplete="off" placeholder="请输入工作年限" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">口碑值</label>
						<div class="layui-input-inline">
							<input type="number" name="score" required="" lay-verify="required" autocomplete="off" placeholder="星级评定,输入1-5" class="layui-input">
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">设计理念</label>
					 <div class="layui-input-block">
						<input type="text" name="design_idea" lay-verify="design_idea" autocomplete="off" placeholder="请输入行政区域" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item" style="margin:50px auto 20px auto; text-align: center;">
					<button class="layui-btn p40" lay-filter="add" lay-submit="" id="addfrom">提交</button>
					<button type="reset" class="layui-btn p40 layui-btn-primary">重置</button>
				</div>
			</form>
		</div>
		<script>
			layui.use(['form', 'layer', 'element', 'upload'], function() {
				var $ = layui.jquery
				var form = layui.form,
					layer = layui.layer,
					upload = layui.upload;
				//普通图片上传
				var uploadInst = upload.render({
					elem: '#img',
					exts: 'jpg|png|jpeg', //只允许上传图片格式
					size: 60 ,//限制文件大小，单位 KB
					url: '/upload/',
					before: function(obj) {
						//预读本地文件示例，不支持ie8
						obj.preview(function(index, file, result) {
							$('#img_show').attr('src', result); //图片链接（base64）
						});
					},
					done: function(res) {
						//如果上传失败
						if(res.code > 0) {
							return layer.msg('上传失败');
						}
						//上传成功
					},
					error: function() {
						//演示失败状态，并实现重传	
					}
				});
				//监听提交
				form.on('submit(add)', function(data) {
					console.log(data);
					//发异步，把数据提交给php
					layer.alert("增加成功", {
						icon: 6
					}, function() {
						// 获得frame索引
						var index = parent.layer.getFrameIndex(window.name);
						//关闭当前frame
						parent.layer.close(index);
					});
					return false;
				});
			});
		</script>
	</body>
</html>